package com.three.digit;

import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.io.FileUtils;


public class Test
{

    /**
     * @param args
     * @throws IOException 
     */
    public static void main (String[] args) throws IOException
    {
        File file = new File ("C:/Users/syin/dependency.txt");
        List<String> lines = FileUtils.readLines (file);
        
        
        
        File file1 = new File ("C:/Users/syin/dependency1.txt");
        List<String> lines1 = FileUtils.readLines (file1);
        
        for (String key : lines1)
        {
            key = key.trim ();
            key = key.replace ("<include>", "").replace ("</include>", "");
//            System.out.println (key);
            for (String str : lines)
            {
                if (str.indexOf (key)!=-1)
                {
                    str = str.substring (str.indexOf (key),str.lastIndexOf (":"));
                    
                    String[] ds = str.split (":");
                    
                    System.out.println ("<dependency>");
                    System.out.println ("<groupId>"+ds[0]+"</groupId>");
                    System.out.println ("<artifactId>"+ds[1]+"</artifactId>");
                    System.out.println ("<version>"+ds[3]+"</version>");
                    System.out.println ("</dependency>");
                }
            }
        }
        
        
        
        
    }
}
